package com.tms.app.tms.adapter;

import android.graphics.Color;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tms.app.tms.R;

import java.io.File;

import cn.edu.zafu.camera.OrcText;

/**
 * Created by happy on 2017/8/26.
 */

public class BdAdapter extends BaseQuickAdapter<OrcText, BaseViewHolder> {
    public BdAdapter() {
        super(R.layout.item_layout_db);
    }




    @Override
    protected void convert(BaseViewHolder helper, OrcText item) {

        TextView textView=helper.getView(R.id.text1);
        helper.setText(R.id.text1,"识别内容："+item.getResultBd());
        helper.setText(R.id.text2,"输入内容："+item.getResuletCusm());
        if (item.getResultCode()==1){
            helper.setText(R.id.text3,"是否识别成功：是");
            textView.setTextColor(Color.GRAY);
        }
        else{
            helper.setText(R.id.text3,"是否识别成功：否");
            textView.setTextColor(Color.RED);
        }
        ImageView imageView=helper.getView(R.id.img);
        Glide.with(imageView.getContext()).load(new File(item.getUrl())).error(R.mipmap.ic_launcher).into(imageView);
    }
}
